package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.StoredValueCardManagementMapper;
import com.ruoyi.system.domain.StoredValueCardManagement;
import com.ruoyi.system.service.IStoredValueCardManagementService;

/**
 * 储值卡管理 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-20
 */
@Service
public class StoredValueCardManagementServiceImpl extends ServiceImpl<StoredValueCardManagementMapper, StoredValueCardManagement> implements IStoredValueCardManagementService
{
    @Autowired
    private StoredValueCardManagementMapper storedValueCardManagementMapper;

    /**
     * 通过id查询储值卡管理
     *
     * @param id 储值卡管理主键
     * @return 储值卡管理
     */
    @Override
    public StoredValueCardManagement selectStoredValueCardManagementById(Long id)
    {
        return storedValueCardManagementMapper.selectStoredValueCardManagementById(id);
    }

    /**
     * 通过卡名称和卡状态查询储值卡管理列表
     *
     * @param cardName,status 卡名称,卡状态
     * @return 储值卡管理
     */
    @Override
    public List<StoredValueCardManagement> selectStoredValueCardManagementListByConditions(String cardName,String status)
    {
        return storedValueCardManagementMapper.selectStoredValueCardManagementListByConditions(cardName,status);
    }

    /**
     * 新增储值卡管理
     *
     * @param storedValueCardManagement 储值卡管理
     * @return 结果
     */
    @Override
    public int insertStoredValueCardManagement(StoredValueCardManagement storedValueCardManagement)
    {
        storedValueCardManagement.setCreateTime(DateUtils.getNowDate());
        return storedValueCardManagementMapper.insertStoredValueCardManagement(storedValueCardManagement);
    }

    /**
     * 修改储值卡管理
     *
     * @param storedValueCardManagement 储值卡管理
     * @return 结果
     */
    @Override
    public int updateStoredValueCardManagement(StoredValueCardManagement storedValueCardManagement)
    {
        storedValueCardManagement.setUpdateTime(DateUtils.getNowDate());
        return storedValueCardManagementMapper.updateStoredValueCardManagement(storedValueCardManagement);
    }

    /**
     * 通过id批量删除储值卡管理信息
     *
     * @param ids 需要删除的储值卡管理主键
     * @return 结果
     */
    @Override
    public int deleteStoredValueCardManagementByIds(Long[] ids)
    {
        return storedValueCardManagementMapper.deleteStoredValueCardManagementByIds(ids);
    }

    /**
     * 通过id删除储值卡管理信息
     *
     * @param id 储值卡管理主键
     * @return 结果
     */
    @Override
    public int deleteStoredValueCardManagementById(Long id)
    {
        return storedValueCardManagementMapper.deleteStoredValueCardManagementById(id);
    }
}
